

namespace Identity.Application.Contracts.Common;

public class Result
{
    public bool IsSuccess { get; }
    public IEnumerable<string> Errors { get; }
    public object? Data { get; }

    public static Result Success(object? data = null) => new(true, data, Array.Empty<string>());
    public static Result Failure(params IEnumerable<string> errors) => new(false, null, errors);

    private Result(bool isSuccess, object? data, IEnumerable<string>? errors)
    {
        IsSuccess = isSuccess;
        Data = data;
        Errors = errors ?? Array.Empty<string>(); 
    }
}
